﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CostTrade.BusinessLayer.Interface;
using Natrue.Popedom.Menu;

namespace CostTrade.BusinessLayer.DataInit
{
    public class FuturesDataWaizd : IModuleDataWizard
    {

        #region IModuleDataWizard 成员

        public string WizardKey
        {
            get { return "FuturesDataWaizd"; }
        }

        public Type[] ArObjects()
        {
            return null;
        }

        public Natrue.Popedom.Menu.MenuBuilder InitModuleSystemMenu(Natrue.Popedom.Menu.UserPopedom adminPopedom)
        {
            MenuBuilder builder = MenuBuilder.CreateRootMenuBuilder(new MenuNode { Caption = "期货订单管理", MenuIndex = 1, MenuKey = "FuturesManager" });
            builder.AddSubCommand(NewMenuCommand("futuresDraft", "草稿箱", "/Futures/FuturesOrderDraft"));
            builder["futuresDraft"].AddCommandButton(NewButton("view","查看",CommandButtonIcons.loodover));
            builder["futuresDraft"].AddCommandButton(NewButton("addNew", "新建", CommandButtonIcons.New));
            builder["futuresDraft"].AddCommandButton(NewButton("edit", "编辑", CommandButtonIcons.admend));
            builder["futuresDraft"].AddCommandButton(NewButton("delete", "删除", CommandButtonIcons.repeal));
            builder["futuresDraft"].AddCommandButton(NewButton("formalorder","生成正式订单",CommandButtonIcons.sure));
            builder["futuresDraft"].AddCommandButton(NewButton("save","保存",CommandButtonIcons.temporarySave));

            builder.AddSubCommand(NewMenuCommand("FormalOrder", "正式订单", "/Futures/FormalFuturesOrder"));
            builder["FormalOrder"].AddCommandButton(NewButton("view", "查看", CommandButtonIcons.loodover));
            builder["FormalOrder"].AddCommandButton(NewButton("addNew", "新建", CommandButtonIcons.New));
            builder["FormalOrder"].AddCommandButton(NewButton("edit", "编辑", CommandButtonIcons.admend));
            builder["FormalOrder"].AddCommandButton(NewButton("cancel", "撤消订单", CommandButtonIcons.NoputIn));
            builder["FormalOrder"].AddCommandButton(NewButton("updatestate","更新订单状态",CommandButtonIcons.sure));
            builder["FormalOrder"].AddCommandButton(NewButton("save","保存",CommandButtonIcons.temporarySave));

            builder.AddSubCommand(NewMenuCommand("FinishOrder", "已完成订单", "/Futures/FinishFuturesOrder"));
            builder["FinishOrder"].AddCommandButton(NewButton("view", "查看详情", CommandButtonIcons.loodover));

            builder.AddSubCommand(NewMenuCommand("FuturesOrderStat", "订单统计", "/Futures/FuturesOrderStat"));

            builder.Create();
            return builder;
        }

        public void InitSmartView()
        {
            
        }

        public Type[] InitIBOPropertyInfo()
        {
            return new Type[0];
        }

        public Type[] InitEnumPropertyInfo()
        {
            return new[] { 
            typeof(FuturesState)
            };
        }

        public void InitModuleData()
        {
            
        }

        #endregion


        static CommandButton NewButton(string menukey, string caption, CommandButtonIcons icon)
        {
            return new CommandButton { MenuKey = menukey, Caption = caption, Icon = icon };
        }
        static MenuCommand NewMenuCommand(string menukey, string caption, string actionUrl)
        {
            return new MenuCommand { MenuKey = menukey, Caption = caption, ActionUrl = actionUrl };
        }
        static MenuNode NewMenuNode(string menukey, string caption, string actionUrl)
        {
            return new MenuNode { MenuKey = menukey, Caption = caption, ActionUrl = actionUrl };
        }
        static MenuNode NewMenuNode(string menukey, string caption)
        {
            return new MenuNode { MenuKey = menukey, Caption = caption, ActionUrl = "" };
        }
        static StandPage NewStandPage(string menukey, string caption)
        {
            return new StandPage { Caption = caption, MenuKey = menukey };
        }
    }
}
